 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>欢迎登录Frank Boot</title>
<style>
body{
	background: #ebebeb;
	font-family: "Helvetica Neue","Hiragino Sans GB","Microsoft YaHei","\9ED1\4F53",Arial,sans-serif;
	color: #222;
	font-size: 12px;
}
*{padding: 0px;margin: 0px;}
.top_div{
	/* background: #008ead; */
	background: #5FB878;
	width: 100%;
	height: 400px;
	
	/* 文字 */
	font-size: 32px;
    color: #fff;
    line-height: 300px;
    text-align: center;
    font-family: monospace;
    
}
.ipt{
	border: 1px solid #d3d3d3;
	padding: 10px 10px;
	width: 290px;
	border-radius: 4px;
	padding-left: 35px;
	-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
	box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
	-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
	-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
	transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s
}
.ipt:focus{
	/* border-color: #66afe9; */
	border-color: #5FB878;
	outline: 0;
	-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
	box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
}
.u_logo{
	background: url("../../admin/images/login/user.png") no-repeat;
	padding: 10px 10px;
	position: absolute;
	top: 40px;
	left: 40px;

}
.p_logo{
	background: url("../../admin/images/login/password.png") no-repeat;
	padding: 10px 10px;
	position: absolute;
	top: 10px;
	left: 40px;
}
a{
	text-decoration: none;
}
.tou{
	background: url("../../admin/images/login/tou.png") no-repeat;
	width: 97px;
	height: 92px;
	position: absolute;
	top: -87px;
	left: 140px;
}
.left_hand{
	background: url("../../admin/images/login/left_hand.png") no-repeat;
	width: 32px;
	height: 37px;
	position: absolute;
	top: -38px;
	left: 150px;
}
.right_hand{
	background: url("../../admin/images/login/right_hand.png") no-repeat;
	width: 32px;
	height: 37px;
	position: absolute;
	top: -38px;
	right: -64px;
}
.initial_left_hand{
	background: url("../../admin/images/login/hand.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -12px;
	left: 100px;
}
.initial_right_hand{
	background: url("../../admin/images/login/hand.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -12px;
	right: -112px;
}
.left_handing{
	background: url("../../admin/images/login/left-handing.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -24px;
	left: 139px;
}
.right_handinging{
	background: url("../../admin/images/login/right_handing.png") no-repeat;
	width: 30px;
	height: 20px;
	position: absolute;
	top: -21px;
	left: 210px;
}

</style>
    <script src="../../common/js/jquery-1.11.2.min.js"></script> 
<script type="text/javascript">
$(function(){
	
	// 登录过期的时候，跳出ifram框架
	if (top.location != self.location) {
	    top.location = self.location
	};
	
	// 绑定回车事件
	$("body").keydown(function () {
		if (event.keyCode == "13") { // keyCode=13是回车键
			$("#login").click(); 
		}
	});
	
	
	//得到焦点
	$("#password").focus(function(){
		$("#left_hand").animate({
			left: "150",
			top: " -38"
		},{step: function(){
			if(parseInt($("#left_hand").css("left"))>140){
				$("#left_hand").attr("class","left_hand");
			}
		}}, 2000);
		$("#right_hand").animate({
			right: "-64",
			top: "-38px"
		},{step: function(){
			if(parseInt($("#right_hand").css("right"))> -70){
				$("#right_hand").attr("class","right_hand");
			}
		}}, 2000);
	});
	//失去焦点
	$("#password").blur(function(){
		$("#left_hand").attr("class","initial_left_hand");
		$("#left_hand").attr("style","left:100px;top:-12px;");
		$("#right_hand").attr("class","initial_right_hand");
		$("#right_hand").attr("style","right:-112px;top:-12px");
	});
});

function login(){
	
	$("#error").html("");
	
	$("#login").attr("disabled",true);
	$("#login").css({'background-color' : '#c2c2c2'});
	$("#login").css({'border': '1px solid #c2c2c2'});
	$("#login").html('登录中...');
	var userName=$("#userName").val();
	var password=$("#password").val();
	if(userName==null||userName==""){
		$("#error").html("账号不能为空！");
		return false;
	}
	if(password==null||password==""){
		$("#error").html("密码不能为空！");
		return false;
	}
	$.post("/login",{"username":userName,"password":password},function(res){
		console.log('res',res);
		if(res.code == 0){
			$("#success").html("登录成功");
			$("#error").hide();
			setTimeout(function(){
				location.href = "/index";
			},800);
		}else if("Bad credentials" == res.msg){
			$("#error").html("账号或密码错误！");
			
			$("#login").attr("disabled",false);
			$("#login").css({'background-color' : '#5FB878'});
			$("#login").css({'border': '1px solid #5FB878'});
			$("#login").html('登录');
			
		}else{
			$("#error").html(res.msg);
			
			$("#login").attr("disabled",false);
			$("#login").css({'background-color' : '#5FB878'});
			$("#login").css({'border': '1px solid #5FB878'});
			$("#login").html('登录');
		}
	});
}
</script>
</head>
<body>
<div class="top_div">
	 
	<span style="vertical-align:-webkit-baseline-middle;"><img src="admin/images/logo-jiandan.png" width="50px"></span> Frank Boot 权限管理系统
</div>
<div>
	<div style="background: rgb(255, 255, 255); margin: -100px auto auto; border: 1px solid rgb(231, 231, 231); border-image: none; width: 400px; height: 200px; text-align: center;border-radius: 4px;">
		<div style="width: 165px; height: 96px; position: absolute;">
			<div class="tou">
			</div>
			<div class="initial_left_hand" id="left_hand">
			</div>
			<div class="initial_right_hand" id="right_hand">
			</div>
		</div>
		<P style="padding: 30px 0px 10px; position: relative;">
			<span class="u_logo"></span>
			<input id="userName" name="userName" class="ipt" type="text" placeholder="请输入账号" value="admin"> 
	    </P>
		<P style="position: relative;">
			<span class="p_logo"></span>         
			<input id="password" name="password" class="ipt"  type="password" placeholder="请输入密码" value="123456">   
	  	</P>
		<div style="height: 50px; line-height: 58px; margin-top: 30px; border-top-color: rgb(231, 231, 231); border-top-width: 1px; border-top-style: solid;">
			<P style="margin: 0px 34px 20px 45px;">
			<!-- <span style="float: left;">欢迎登录Frank Boot</span>  -->
			<span style="font-weight: bold;font-size: 14px;"><span style="color: #5FB878" id="success"></span><span style="color: #FF5722" id="error"></span></span>
	        <span style="float: right;"> 
	              <!-- <input type="submit" style="background: rgb(0, 142, 173); padding: 7px 10px; border-radius: 4px; border: 1px solid rgb(26, 117, 152); border-image: none; color: rgb(255, 255, 255); font-weight: bold;" value="登录"/> --> 
	              <button id="login" onclick="login()" style="background: #5FB878; padding: 7px 10px; border-radius: 4px; border: 1px solid #5FB878; border-image: none; color: rgb(255, 255, 255); font-weight: bold;">登&nbsp;&nbsp;录</button>
	         </span>         
	         </P>
	    </div>
	</div>
</div>
</body>
</html>